<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>排他思想</title>
    <style>
        .change {
            background-color: pink;
        }
    </style>
</head>
<body>
    <button class="change">1</button>
    <button>2</button>
    <button>3</button>
    <button>4</button>
    <button>5</button>
</body>
<script>
    var btns = document.querySelectorAll('button')
    for(var i=0 ; i<btns.length;i++){
        btns[i].onclick=function(){
            for(var i=0;i<btns.length;i++){
                btns[i].className = ''
            }
            this.className = 'change'
        }
    }
</script>
</html>